<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        table{
            width: 72%;
            margin: 100px auto;
            text-align: center;
            color: #fff;
        }
        table tr:nth-child(1) td{
            background: #c7254e;
            font-weight: bold;
        }
        table td{
            width: 18%;
            height: 40px;
            line-height: 40px;
            background: #099;
        }
        img{
            width: 100px;
            vertical-align: center;
        }
    </style>
    <script src="/static/js/jquery.js"></script>
</head>
<body>
    <table>
        <tr>
            <td>编号</td>
            <td>书名</td>
            <td>价格(单位 : 元)</td>
            <td>描述</td>
            <td>预览</td>
        </tr>
        <% for(let i in books) { %>
            <tr>
                <td><%= books[i].id %></td>
                <td><%= books[i].name %></td>
                <td><%= books[i].price %></td>
                <td><%= books[i].description %></td>
                <td><img src="<%=books[i].imgsrc%>" alt="<%=books[i].imgsrc%>" onclick="goDownload(this.src)"></td>
            </tr>
        <% } %>
    </table>
</body>
<script>
    function goDownload(path){
        window.location.href="/book/book/download?path="+path;
    }
</script>
</html>